package com.ideabove.adapter;

import java.util.ArrayList;
import java.util.List;

import com.ideabove.radio.R;
import com.ideabove.util.img.ImageLoader;
import com.ideabove.data.Channel;
import com.ideabove.data.Folder;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class FolderAdapter extends BaseAdapter
{

	private List<Folder> mList;
	private LayoutInflater mInflater;    

	public FolderAdapter(Context c , ArrayList<Folder> arrays){
		this.mInflater = LayoutInflater.from(c);
		this.mList = arrays;
	}

	int index = 0;

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		Folder folder = mList.get(position);
		
		if(convertView == null)
		{
			convertView = mInflater.inflate(R.layout.row_folder_normal, null);		
		}
		
		
		if("0".equals(folder.getType())){
			ImageView folder_img = (ImageView) convertView.findViewById(R.id.folder_img);
			folder_img.setImageResource(R.drawable.img_like);
		}else{
			ImageView folder_img = (ImageView) convertView.findViewById(R.id.folder_img);
			folder_img.setImageResource(R.drawable.img_lp);
		}
		
		TextView content = (TextView) convertView.findViewById(R.id.folder_name);
		content.setTag(folder.getFolder_id());
		content.setText(folder.getTitle());
		
		TextView folder_song_cnt = (TextView)convertView.findViewById(R.id.folder_song_cnt);
		folder_song_cnt.setText(folder.getSong_count());
		return convertView;
	}



	@Override
	public int getCount() {
		return mList.size();
	}
	@Override
	public Folder getItem(int position) {
		return mList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

}
